package cn.jiyun.service.impl;

import cn.jiyun.mapper.ClockMapper;
import cn.jiyun.pojo.Clock;
import cn.jiyun.pojo.Employees;
import cn.jiyun.pojo.dto.BaseDto;
import cn.jiyun.service.ClockService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClockServiceImpl extends ServiceImpl<ClockMapper, Clock> implements ClockService {
    @Autowired
    ClockMapper clockMapper;

    @Override
    public List<Clock> select() {
        return clockMapper.all();
    }

    @Override
    public void updatefase(BaseDto dto) {
        clockMapper.updatefase(dto);
    }

    @Override
    public Employees getEmployees(Integer id) {
        return clockMapper.getEmployees(id);
    }

    @Override
    public void insert(Clock clock) {
        clockMapper.add(clock);
    }

    @Override
    public List<Clock> getClock(String format1) {
        return clockMapper.findById(format1);
    }

    @Override
    public Employees getByidEmployyes(Integer id) {
        return clockMapper.findByIdClock(id);
    }

//    @Override
//    public Clock login(Clock user) {
//        try {
//            user.setPassword(MD5Utils.md5Hex(user.getPassword().getBytes()));
//        } catch (NoSuchAlgorithmException e) {
//            throw new RuntimeException(e);
//        }
//        return userMapper.login(user);
//    }
}
